#include <stdio.h>
#include <include/cstl.h>


void print_list(list_t list)
{
    printf("size: %d\nUp: ", list_size(list));
    list_node_t cur = list_front(list);
    size_t index = 0;

    while(cur)
    {
        printf("[%d] %d;", index, *((int*)cur->content));
        cur = cur->next;
        ++index ;
    }

    printf("\nDown: ");
    cur = list_back(list);
    while(cur)
    {
        printf("[%d] %d;", index, *((int*)cur->content));
        cur = cur->prev;
        --index;
    }
    printf("\n");
}

int main()
{
    cstl_init();
    int a = 1, b = 2;
    list_t list = list_create(int);
    list_pop_front(list);
    list_pop_back(list);
    print_list(list);
    list_destroy(list);

    list = list_create(int);
    list_push_back(list, &a);
    print_list(list);
    list_push_back(list, &b);
    print_list(list);
    list_destroy(list);

    list = list_create(int);
    list_push_back(list, &a);
    print_list(list);
    list_push_back(list, &b);
    print_list(list);
    list_destroy(list);
    
    cstl_exit();
    return 0;
}
